import Vue from 'vue';
import Router from 'vue-router';
Vue.use(Router)

export default new Router({
  routes: [{
    path: '/Login',
    component: resolve => require(['@/views/Login.vue'], resolve),
  }, {
    path: '/',
    component: resolve => require(['@/views/index.vue'], resolve),
    redirect: '/config/site',
  },
  {
    path: '/index',
    component: resolve => require(['@/views/index.vue'], resolve),
    redirect: '/dashboard/index',
    children: [
      //首页
      {
        path: '/dashboard/index',
        component: resolve => require(['@/views/dashboard/index.vue'], resolve)
      },
      {
        path: '/advert/index',
        component: resolve => require(['@/views/advert/index.vue'], resolve)
      },
      {
        path: '/article/index',
        component: resolve => require(['@/views/article/index.vue'], resolve)
      },
      {
        path: '/article/cate',
        component: resolve => require(['@/views/article/cate.vue'], resolve)
      },
      {
        path: '/article/add',
        component: resolve => require(['@/views/article/add.vue'], resolve)
      },
      {
        path: '/house/index',
        component: resolve => require(['@/views/house/index.vue'], resolve)
      },
      {
        path: '/house/add',
        component: resolve => require(['@/views/house/add.vue'], resolve)
      },
      {
        path: '/service/index',
        component: resolve => require(['@/views/service/index.vue'], resolve)
      },
      {
        path: '/service/add',
        component: resolve => require(['@/views/service/add.vue'], resolve)
      },
      {
        path: '/article/view',
        component: resolve => require(['@/views/article/view.vue'], resolve)
      },
      {
        path: '/config/dict',
        component: resolve => require(['@/views/config/dict.vue'], resolve)
      },
      {
        path: '/config/site',
        component: resolve => require(['@/views/config/site.vue'], resolve)
      },
      {
        path: '/config/icon',
        component: resolve => require(['@/views/config/icon.vue'], resolve)
      },
      {
        path: '/config/about',
        component: resolve => require(['@/views/config/about.vue'], resolve)
      },
      {
        path: '/config/wechat',
        component: resolve => require(['@/views/config/wechat.vue'], resolve)
      },
      {
        path: '/config/password',
        component: resolve => require(['@/views/config/password.vue'], resolve)
      },
      {
        path: '/area/index',
        component: resolve => require(['@/views/area/index.vue'], resolve)
      },
      {
        path: '/photos/index',
        component: resolve => require(['@/views/photos/index.vue'], resolve)
      },
      {
        path: '/photos/category',
        component: resolve => require(['@/views/photos/category.vue'], resolve)
      },
      {
        path: '/admin/index',
        component: resolve => require(['@/views/auth/admin/index.vue'], resolve)
      },
      {
        path: '/admin/auth_menu',
        component: resolve => require(['@/views/auth/auth_menu/index.vue'], resolve)
      },
      {
        path: '/admin/auth_role',
        component: resolve => require(['@/views/auth/auth_role/index.vue'], resolve)
      },
    ]
  },
  ],
  scrollBehavior(to, from, savedPosition) {
    return {
      x: 0,
      y: 0
    }
  }
})